package com.lovely602.langchain4j.helloworld.config;


import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 *
 * @author lizhixing
 */
@Configuration
public class LLMConfig {

    /**
     *
     * base_url：https://dashscope.aliyuncs.com/compatible-mode/v1  可用
     * base_url：https://dashscope.aliyuncs.com/compatible-mode  不可用
     * 注册通义千问聊天模型
     */
    @Bean("chatModelQwen")
    public ChatModel chatModelQwen() {
        return OpenAiChatModel.builder()
                .apiKey(System.getenv("AI_DASHSCOPE_API_KEY"))
                .baseUrl("https://dashscope.aliyuncs.com/compatible-mode/v1")
                .modelName("qwen-plus")
                .build();
    }

    /**
     * base_url: https://api.deepseek.com
     * base_url: https://api.deepseek.com/v1
     * 两种均可
     * 注册deepSeek聊天模型
     */
    @Bean("chatModelDeepSeek")
    public ChatModel chatModelDeepSeek() {
        return OpenAiChatModel.builder()
                .apiKey(System.getenv("AI_DEEPSEEK_API_KEY"))
                .baseUrl("https://api.deepseek.com/v1")
                .modelName("deepseek-chat")
                .build();
    }
}
